<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
	<section class="content">
       <div>
       		<div class="col-xs-12">
	       		<div class="box">
	           	<div class="box-header">
	               <nav class="navbar" style="margin-bottom: 0;">	     
				          <form class="navbar-form form-inline" method="post">
				            <div class="form-group">
				              	<input type="text" name="keywords" class="form-control" placeholder="搜索">
				            </div>
			                <div class="form-group">
                                <label class="control-label" for="input-date-added">添加日期</label>
                                <div class="input-group">
                                    <input type="text" name="timegap" value="{$timegap}" placeholder="添加日期"  id="add_time" class="input-sm" style="width:250px;">
				                 </div>
                            </div>
                            <a href="javascript:;" onclick="openfullinfo('{:U('Promotion/prom_full_info')}')" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> 添加满赠活动</a>
				            <!--<button type="submit" class="btn btn-primary">提交</button>  -->
				            <a href="javascript:void(0)" onclick="ajax_get_table('search-form2',1)" id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选</a>
				          </form>		
	    			</nav>                
	             </div>	    
	             <!-- /.box-header -->
                    <div id="ajax_return">

                    </div>
	        </div><!-- /.box -->
       	</div>
       </div>
   </section>
</div>
<script>
 $(document).ready(function(){
        ajax_get_table('search-form2',1,0); //默认ajax第一页
        
		$('#add_time').daterangepicker({
			format:"YYYY-MM-DD HH:mm",
			singleDatePicker: false,
			showDropdowns: true,
			minDate:'2020-01-01 00:00',
			maxDate:'2030-01-01 00:00',
			startDate:'{:date("Y-m-d H:i")} 00:00',
			opens: 'left',
		    locale : {
	            applyLabel : '确定',
	            cancelLabel : '取消',
	            fromLabel : '起始时间',
	            toLabel : '结束时间',
	            customRangeLabel : '自定义',
	            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
	            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
	            firstDay : 1
	        }
		});
    });
        // 点击排序
    function sort(field)
    {
        $("input[name='order_by']").val(field);
        var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
        $("input[name='sort']").val(v);
        ajax_get_table('search-form2',cur_page);
    }
        // ajax 抓取页面
    function ajax_get_table(tab,page,number){
        cur_page = page; //当前页面 保存为全局变量
            $.ajax({
                type : "POST",
                url:"/index.php/Admin/Promotion/ajaxprom_full_list/p/"+page+"/n/"+number,//+tab,
                data : $('#'+tab).serialize(),// 你的formid
                success: function(data){
                    $("#ajax_return").html('');
                    $("#ajax_return").append(data);
                }
            });
    }
function openfullinfo(url){
	var goods_id = []; 
	//过滤选择重复商品
	$('input[name*="goods_id"]').each(function(i,o){
		goods_id.push($(o).val());
	});
    // var url = '/index.php?m=Seller&c=Promotion&a=search_goods&goods_id='+goods_id+'&t='+Math.random();
    layer.open({
        type: 2,
        title: '添加满赠活动',
        shadeClose: true,
        shade: 0.3,
        area: ['80%', '80%'],
        content: url, 
    });
}
$('.goods_list').click(function(){
    var url = $(this).attr('data-url');
    layer.open({
        type: 2,
        title: '活动关联商品列表',
        shadeClose: true,
        shade: 0.5,
        area: ['70%', '72%'],
        content: url, 
    });
});
</script>
</body>
</html>